package com.platform.hjt.erp.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.hibernate.annotations.GenericGenerator;

import com.platform.hjt.erp.model.json.ErpGoodInfoSerializer;
import com.platform.hjt.erp.model.json.ErpStorageSerializer;

/**
 * ErpStock entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "erp_stock")
public class ErpStock implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -6353853510074128601L;
	private String erpStockId;
	private ErpGoodInfo erpGoodInfo;
	private ErpStorage erpStorage;

	private String color;
	
	private Double goodCount;

	// Constructors

	/** default constructor */
	public ErpStock() {
	}

	/** minimal constructor */
	public ErpStock(String erpStockId) {
		this.erpStockId = erpStockId;
	}

	/** full constructor */
	public ErpStock(String erpStockId, ErpGoodInfo erpGoodInfo,
			ErpStorage erpStorage, Double goodCount) {
		this.erpStockId = erpStockId;
		this.erpGoodInfo = erpGoodInfo;
		this.erpStorage = erpStorage;
		this.goodCount = goodCount;
	}

	// Property accessors
	@Id
	@GenericGenerator(name="systemUUID",strategy="uuid")
	@GeneratedValue(generator="systemUUID")
	@Column(name = "erp_stock_id", unique = true, nullable = false, length = 32)
	public String getErpStockId() {
		return this.erpStockId;
	}

	public void setErpStockId(String erpStockId) {
		this.erpStockId = erpStockId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "erp_good_info_id")
	@JsonSerialize(using = ErpGoodInfoSerializer.class)
	public ErpGoodInfo getErpGoodInfo() {
		return this.erpGoodInfo;
	}

	public void setErpGoodInfo(ErpGoodInfo erpGoodInfo) {
		this.erpGoodInfo = erpGoodInfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "erp_storage_id")
	@JsonSerialize(using = ErpStorageSerializer.class)
	public ErpStorage getErpStorage() {
		return this.erpStorage;
	}

	public void setErpStorage(ErpStorage erpStorage) {
		this.erpStorage = erpStorage;
	}

	@Column(name = "good_count", precision = 22, scale = 0)
	public Double getGoodCount() {
		return this.goodCount;
	}

	public void setGoodCount(Double goodCount) {
		this.goodCount = goodCount;
	}

	@Column(name = "color")
	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

}